<template>
  <el-dialog
      title="驳回原因"
      :visible.sync="open"
      width="400px"
      append-to-body
      @close="resetForm"
  >
<!--    {{JSON.stringify(form,null,4)}}-->
    <el-form ref="form" :model="form"  label-position="top" label-width="120px"  style='margin-top: 0px;'>

      <el-row>
        <el-col :span="24">
          <el-form-item label="" prop="rejectReason"  >
            <el-input maxlength="50" :rows="4" type="textarea" v-model="form.rejectReason" placeholder="请输入"/>
            <div class="wordStat">
              {{this.form.rejectReason.length}}  / 50
            </div>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="submitForm">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import {checkRelative} from "@/api/organizationOuter/audit";
let defaultForm = {
  "id": "",
  "type": "2", // 	1:组织审核 2；个人审核
  "auditStatus": "3",
  "rejectReason": ""
}
export default {
  components: {
  },
  data() {
    return {
      form: JSON.parse(JSON.stringify(defaultForm)),
      open: false,
      idRule:[]
    };
  },
  methods: {
    show(row) {
      // console.log('row',row)
      this.open = true;
      this.form = Object.assign(this.form, {id:row.id})
    },
    submitForm(){
      // console.log('jiek', this.form)
      checkRelative(this.form).then((response) => {
        this.$message({
          message: '编辑成功',
          type: 'success'
        });
        this.open = false;
        this.$emit("getList");
      }).catch(err=>{
        console.error('err',err)
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
    /** 重置按钮操作 */
    resetForm() {
      this.form = JSON.parse(JSON.stringify(defaultForm))
    },
  },
};
</script>
<style lang="less" scoped>
.wordStat{
  width:100%;
  font-size:12px;
  display: flex;
  justify-content: flex-end;
  transform: translate(-10px,-30px);
}
</style>
